package implement

import (
	"sync"
)

type SafeCounter struct {
	mu  sync.Mutex
	val int
}

func (c *SafeCounter) Increment() {
	c.mu.Lock()
	c.val++
	c.mu.Unlock()
}

func (c *SafeCounter) Value() int {
	c.mu.Lock()
	defer c.mu.Unlock()
	return c.val
}
